﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using FabrikatorDB;

namespace Fabrikatorum.Fabrikator.Sayfa
{
    public partial class Fabrikalariniz : System.Web.UI.Page
    {
        //public string sehirdeneme { get; set; }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["uye"] != null)
            {
                using (FabriDataContext db = new FabriDataContext())
                {
                    Uye girisyapan = (Uye)Session["uye"];
                    var fabrikalar = (from snc in db.Fabrikalars where snc.UyeNo == girisyapan.UyeNo select snc);
                    ListView1.DataSource = fabrikalar;
                    ListView1.DataBind();
                    //string sehirlistesi = string.Empty;
                    //var sehirler = from shr in db.Sehirs select shr;
                    //foreach (Sehir item in sehirler)
                    //{
                    //    sehirlistesi += "\"" + item.SehirNo + "\":" + "\"" + item.Nufus + "\",";
                    //}
                    //sehirdeneme = sehirlistesi;
                }
            }
            else
            {
                Response.Redirect("~/Fabrikator/Sayfa/Giris.aspx"); 
            }
        }
    }
}